package com.jiangruanjavaproject.service;

import com.alibaba.fastjson.JSONObject;
import com.jiangruanjavaproject.Constants;
import com.jiangruanjavaproject.Conversion;
import com.jiangruanjavaproject.bean.FontConversion;
import com.jiangruanjavaproject.bean.HotVideoCommon;
import com.jiangruanjavaproject.request.HttpUtils;

import java.util.Scanner;

/**
 * @author:wanfeng
 * @desc:
 * @datetime:2021/12/30 19:06
 */
public class FontService {
    public String getFontService(){

        /*Scanner scanner1 = new Scanner(System.in);
        System.out.println("请输入数据");
        String  instr = scanner1.next();*/
        String url = Conversion.Font_URL
                +"?text=%E5%8A%9F%E5%A4%AB%E6%A0%BC%E6%96%97"
                +"&type=1"
                +"&key=" + Conversion.Font_KEY;
        String result = HttpUtils.get(url);
        System.out.println(result);

        //json解析
        FontConversion fontConversion = JSONObject.parseObject(result, FontConversion.class);
        System.out.println(fontConversion.error_code);
        System.out.println(fontConversion.reason);
        System.out.println(fontConversion.instr);
        System.out.println(fontConversion.outstr);
        return fontConversion.outstr;
    }
}
